package scauCmiScaffolding.compiled;

import org.eclipse.jet.JET2Context;
import org.eclipse.jet.JET2Template;
import org.eclipse.jet.JET2Writer;
import org.eclipse.jet.taglib.RuntimeTagElement;
import org.eclipse.jet.taglib.TagInfo;

public class _jet_countEntity_1 implements JET2Template {
    private static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
    private static final String _jetns_java = "org.eclipse.jet.javaTags"; //$NON-NLS-1$

    public _jet_countEntity_1() {
        super();
    }

    private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
    
    private static final TagInfo _td_java_format_1_1 = new TagInfo("java:format", //$NON-NLS-1$
            1, 1,
            new String[] {
            },
            new String[] {
            } );
    private static final TagInfo _td_c_setVariable_2_2 = new TagInfo("c:setVariable", //$NON-NLS-1$
            2, 2,
            new String[] {
                "select", //$NON-NLS-1$
                "var", //$NON-NLS-1$
            },
            new String[] {
                "$eachTable/primaryKeys/@count", //$NON-NLS-1$
                "pkcount", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_4_22 = new TagInfo("c:get", //$NON-NLS-1$
            4, 22,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "uppercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_5_18 = new TagInfo("c:get", //$NON-NLS-1$
            5, 18,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "lowercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_if_6_6 = new TagInfo("c:if", //$NON-NLS-1$
            6, 6,
            new String[] {
                "test", //$NON-NLS-1$
            },
            new String[] {
                "$pkcount<2", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_6_51 = new TagInfo("c:get", //$NON-NLS-1$
            6, 51,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "uppercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_if_6_110 = new TagInfo("c:if", //$NON-NLS-1$
            6, 110,
            new String[] {
                "test", //$NON-NLS-1$
            },
            new String[] {
                "$pkcount>1", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_6_155 = new TagInfo("c:get", //$NON-NLS-1$
            6, 155,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "uppercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_10_22 = new TagInfo("c:get", //$NON-NLS-1$
            10, 22,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "uppercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_11_62 = new TagInfo("c:get", //$NON-NLS-1$
            11, 62,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "uppercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_12_17 = new TagInfo("c:get", //$NON-NLS-1$
            12, 17,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "lowercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_20_22 = new TagInfo("c:get", //$NON-NLS-1$
            20, 22,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "uppercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_21_19 = new TagInfo("c:get", //$NON-NLS-1$
            21, 19,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "lowercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_21_96 = new TagInfo("c:get", //$NON-NLS-1$
            21, 96,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "uppercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );

    public void generate(final JET2Context context, final JET2Writer __out) {
        JET2Writer out = __out;
        RuntimeTagElement _jettag_java_format_1_1 = context.getTagFactory().createRuntimeTag(_jetns_java, "format", "java:format", _td_java_format_1_1); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_java_format_1_1.setRuntimeParent(null);
        _jettag_java_format_1_1.setTagInfo(_td_java_format_1_1);
        _jettag_java_format_1_1.doStart(context, out);
        JET2Writer _jettag_java_format_1_1_saved_out = out;
        while (_jettag_java_format_1_1.okToProcessBody()) {
            out = out.newNestedContentWriter();
            out.write(NL);         
            RuntimeTagElement _jettag_c_setVariable_2_2 = context.getTagFactory().createRuntimeTag(_jetns_c, "setVariable", "c:setVariable", _td_c_setVariable_2_2); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_setVariable_2_2.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_setVariable_2_2.setTagInfo(_td_c_setVariable_2_2);
            _jettag_c_setVariable_2_2.doStart(context, out);
            _jettag_c_setVariable_2_2.doEnd();
            out.write("\t@Transactional");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic Integer count");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_4_22 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_4_22); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_4_22.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_get_4_22.setTagInfo(_td_c_get_4_22);
            _jettag_c_get_4_22.doStart(context, out);
            _jettag_c_get_4_22.doEnd();
            out.write("s(){");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\treturn ((Long) ");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_5_18 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_5_18); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_5_18.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_get_5_18.setTagInfo(_td_c_get_5_18);
            _jettag_c_get_5_18.doStart(context, out);
            _jettag_c_get_5_18.doEnd();
            out.write("DAO.createQuerySingleResult(");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t\"");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_if_6_6 = context.getTagFactory().createRuntimeTag(_jetns_c, "if", "c:if", _td_c_if_6_6); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_if_6_6.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_if_6_6.setTagInfo(_td_c_if_6_6);
            _jettag_c_if_6_6.doStart(context, out);
            while (_jettag_c_if_6_6.okToProcessBody()) {
                out.write("select count(o) from ");  //$NON-NLS-1$        
                RuntimeTagElement _jettag_c_get_6_51 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_6_51); //$NON-NLS-1$ //$NON-NLS-2$
                _jettag_c_get_6_51.setRuntimeParent(_jettag_c_if_6_6);
                _jettag_c_get_6_51.setTagInfo(_td_c_get_6_51);
                _jettag_c_get_6_51.doStart(context, out);
                _jettag_c_get_6_51.doEnd();
                out.write(" o");  //$NON-NLS-1$        
                _jettag_c_if_6_6.handleBodyContent(out);
            }
            _jettag_c_if_6_6.doEnd();
            RuntimeTagElement _jettag_c_if_6_110 = context.getTagFactory().createRuntimeTag(_jetns_c, "if", "c:if", _td_c_if_6_110); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_if_6_110.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_if_6_110.setTagInfo(_td_c_if_6_110);
            _jettag_c_if_6_110.doStart(context, out);
            while (_jettag_c_if_6_110.okToProcessBody()) {
                out.write("select count(*) from ");  //$NON-NLS-1$        
                RuntimeTagElement _jettag_c_get_6_155 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_6_155); //$NON-NLS-1$ //$NON-NLS-2$
                _jettag_c_get_6_155.setRuntimeParent(_jettag_c_if_6_110);
                _jettag_c_get_6_155.setTagInfo(_td_c_get_6_155);
                _jettag_c_get_6_155.doStart(context, out);
                _jettag_c_get_6_155.doEnd();
                out.write(" o");  //$NON-NLS-1$        
                _jettag_c_if_6_110.handleBodyContent(out);
            }
            _jettag_c_if_6_110.doEnd();
            out.write("\").getSingleResult()).intValue();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t@Transactional");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic Integer count");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_10_22 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_10_22); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_10_22.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_get_10_22.setTagInfo(_td_c_get_10_22);
            _jettag_c_get_10_22.doStart(context, out);
            _jettag_c_get_10_22.doEnd();
            out.write("s(CmiPagination  page) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString sql = CmiSqlUtil.createEntityCountSqlStatement(page,");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_11_62 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_11_62); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_11_62.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_get_11_62.setTagInfo(_td_c_get_11_62);
            _jettag_c_get_11_62.doStart(context, out);
            _jettag_c_get_11_62.doEnd();
            out.write(".class);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\treturn ((Long)");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_12_17 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_12_17); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_12_17.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_get_12_17.setTagInfo(_td_c_get_12_17);
            _jettag_c_get_12_17.doStart(context, out);
            _jettag_c_get_12_17.doEnd();
            out.write("DAO.createQuerySingleResult(sql).getSingleResult()).intValue();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t/**");  //$NON-NLS-1$        
            out.write(NL);         
            out.write(" \t* search  for  name with ajax");  //$NON-NLS-1$        
            out.write(NL);         
            out.write(" \t* ");  //$NON-NLS-1$        
            out.write(NL);         
            out.write(" \t*/");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t@Transactional ");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic Integer count");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_20_22 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_20_22); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_20_22.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_get_20_22.setTagInfo(_td_c_get_20_22);
            _jettag_c_get_20_22.doStart(context, out);
            _jettag_c_get_20_22.doEnd();
            out.write("sByName(String queryName) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("  \t\tQuery query = ");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_21_19 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_21_19); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_21_19.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_get_21_19.setTagInfo(_td_c_get_21_19);
            _jettag_c_get_21_19.doStart(context, out);
            _jettag_c_get_21_19.doEnd();
            out.write("DAO.createNamedQuery(\"count");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_21_96 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_21_96); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_21_96.setRuntimeParent(_jettag_java_format_1_1);
            _jettag_c_get_21_96.setTagInfo(_td_c_get_21_96);
            _jettag_c_get_21_96.doStart(context, out);
            _jettag_c_get_21_96.doEnd();
            out.write("sByName\", -1, -1);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("  \t\tquery.setParameter(1, queryName);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("  \t\treturn new Long((long)query.getSingleResult()).intValue();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            _jettag_java_format_1_1.handleBodyContent(out);
        }
        out = _jettag_java_format_1_1_saved_out;
        _jettag_java_format_1_1.doEnd();
        out.write(NL);         
        out.write(NL);         
        out.write(NL);         
    }
}
